var express = require('express');
var router = express.Router();
var diao = require("./db")
var mongodb = require("mongodb")
var ObjectId = mongodb.ObjectId;
/* GET users listing. */
router.post('/', function(req, res, next) {
  res.send('respond with a resource');
});
//商品添加
router.post('/tian',function(req,res){
  var obj = {
      pname: req.body.pname,
        price: req.body.price,
        oldPrice: req.body.oldPrice,
        inventory: req.body.inventory,
        sel: req.body.sel,
        song: req.body.song,
        pdes: req.body.pdes, //商品性质
        isRed: req.body.isRed
    }
  diao("add","kaoshi",obj,function(){
    res.send({cheng:"添加成功"})
  })
})

module.exports = router;
